import json
from src.common.logger import getLogger
from flask import Blueprint, request, Response
from src.modules.setting.service import SystemSettingService

logger = getLogger()
api = Blueprint("setting", __name__)

@api.route("/setting/list", methods = ['GET'])
def load_setting_list():
    args = request.args
    list = SystemSettingService.load_setting_list(args)
    return Response(json.dumps({ "code": 200, "data": list }), status = 200, mimetype = "application/json")

@api.route("/setting/save", methods = ['POST'])
def save_setting_item():
    args = request.form
    SystemSettingService.save_setting_item(args)
    return Response(json.dumps({ "code": 200, "data": {} }), status = 200, mimetype = "application/json")
